package com.cter.thinkingInSpringBoot.to;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class Post {
	private Long id;
	private String title;
	private String content;

	private Post(Long id, String title, String content) {
		this.id = id;
		this.title = title;
		this.content = content;
	}

	public static <T> PostBuilder<T> builder() {
		return new PostBuilder<T>();
	}

	public static class PostBuilder<T> {
		private Long id;
		private String title;
		private String content;

		private PostBuilder() {
		};

		public PostBuilder<T> id(Long id) {
			this.id = id;
			return this;
		}

		public PostBuilder<T> title(String title) {
			this.title = title;
			return this;
		}

		public PostBuilder<T> content(String content) {
			this.content = content;
			return this;
		}

		@java.lang.Override
		public String toString() {
			return "PostBuilder(id = " + id + ", title = " + title + ", content = " + content + ")";
		}

		public Post build() {
			return new Post(id, title, content);
		}

	}
}
